var pieColorsArray = ['#11B35D', '#C24300', '#00CCD7', '#C67852', '#3B66D7', '#56C1C7'];

//时间变化
function changeTime() {
	var dayStr = dateFormat(new Date(), 'yyyy.MM.dd');
	var timeStr = dateFormat(new Date(), 'HH:mm:ss');
	$("#date").html(timeStr);
	$("#day").html(dayStr);
	if(inter1) clearInterval(inter1);
	inter1=setInterval(function() {
		changeTime();
	}, 1000);
}

function initJYEJYS(){
	setJYE(parseFloat("000000.00").toFixed(2))
	setJYS(parseFloat("000000").toFixed(0))
}
	
function setJYE(jye){
	createJYInfoItem("#jye-detail",  jye);
}
function setJYS(jys){
	createJYInfoItem("#jys-detail",  jys);
}
function dateFormat(dateobj,fmt) { 				//调用举例DateUtil.Format(new Date(),"yyyy-MM-dd");
		var o = {
				"M+": dateobj.getMonth() + 1, //月份 
				"d+": dateobj.getDate(), //日 
				"H+": dateobj.getHours(), //小时 
				"m+": dateobj.getMinutes(), //分 
				"s+": dateobj.getSeconds(), //秒 
				"q+": Math.floor((dateobj.getMonth() + 3) / 3), //季度 
				"S": dateobj.getMilliseconds() //毫秒 
			};
			if(/(y+)/.test(fmt))
			{
				//显示年份，yyyy年匹配2017，yyy匹配017
				fmt = fmt.replace(RegExp.$1, (dateobj.getFullYear() + "").substr(4 - RegExp.$1.length));					
			}
			//遍历o对象匹配月、日等
			for(var k in o){					
				if(new RegExp("(" + k + ")").test(fmt)) {						
				var r=RegExp.$1.length == 1? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length));
				fmt = fmt.replace(RegExp.$1, r);
				}
			}
			return fmt;
		}


function createJYInfoItem(selector, num) {
	var numHtml = [];
	var jyArray = num.toString().split("");
	jyArray.forEach(function(item, i) {
		if(item.indexOf(".") < 0) {
			numHtml.push(`<span class="num">${item}</span>`);
		} else {
			numHtml.push(`<span class="point">.</span>`);
		}
	})
	$(selector).data("num",num).html(numHtml.join(""));
}

function convertToRUpDecimal(value, dbit) {
	var cache = parseFloat(value);
	if(isNaN(cache)) {
		return value;
	}
	dbit = dbit && dbit > 0 ? parseInt(dbit) : 2;
	var cache = Math.round(value * Math.pow(10, dbit)) / Math.pow(10, dbit);
	var cacheOfString = cache.toString();
	var ispoint = cacheOfString.indexOf('.');
	if(ispoint < 0) {
		ispoint = cacheOfString.length;
		cacheOfString += '.';
	}
	while(cacheOfString.length <= ispoint + dbit) {
		cacheOfString += '0';
	}
	return cacheOfString;
}

/* 	function createMRJYList(data) {
var htmlstr = [];
data.forEach(function(item, i) {
	htmlstr.push(`<li>${item}</span>`);
})
$("#bl").html(htmlstr.join(""));
} */


//实时交易量
function activeLastPointToolip(chart) {
	var points = chart.series[0].points;
	chart.tooltip.refresh(points[points.length - 1]);
}


Highcharts.setOptions({
	global: {
		useUTC: false
	},
	title: {
		text: null
	},
	chart: {
		backgroundColor: 'rgba(0,0,0,0)'
	},
	// 所有语言文字相关配置都设置在 lang 里
	lang: {
		resetZoom: '重置缩放比例',

	},
	credits: {
		enabled: false
	},
	exporting: {
		enabled: false
	},
});